package org.smartopen.unionpay.openapi.service.feigin;

import org.smartframework.core.api.Resp;
import org.smartframework.unionpay.domain.request.*;
import org.smartframework.unionpay.domain.result.*;
import org.smartopen.unionpay.openapi.config.UnionPayOpenApiConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "remoteUnionPayOpenApiService",url = "${smart.unionpay.serverUrl:''}", configuration = UnionPayOpenApiConfiguration.class)
public interface RemoteUnionPayOpenApiService {

    /**
     * 统一支付
     *
     * @param request
     * @return
     */
    @PostMapping("/tran/unifiedorder")
    Resp<SmartPayUnifiedorderResult> unifiedorder(@RequestBody SmartPayUnifiedorderRequest request);

    /**
     * 付款码支付
     *
     * @param request
     * @return
     */
    @PostMapping("/tran/micropay")
    Resp<SmartPayMicropayResult> micropay(@RequestBody SmartPayMicropayRequest request);

    /**
     * 订单查询
     *
     * @param request
     * @return
     */
    @PostMapping("/tran/query")
    Resp<SmartPayQueryResult> queryOrder(@RequestBody SmartPayQueryRequest request);

    /**
     * 订单退款
     *
     * @param request
     * @return
     */
    @PostMapping("/tran/refund")
    Resp<SmartPayRefundResult> refundOrder(@RequestBody SmartPayRefundRequest request);

    /**
     * 分账接口
     *
     * @param request
     * @return
     */
    @PostMapping("/profitsharing")
    Resp<SmartProfitSharingResult> profitSharing(@RequestBody SmartProfitSharingRequest request);

    /**
     * 分账接口
     *
     * @param request
     * @return
     */
    @PostMapping("/profitsharing/finish")
    Resp<SmartProfitSharingFinishResult> profitSharingFinish(@RequestBody SmartProfitSharingFinishRequest request);

    /**
     * 商户发起添加分账接收方请求，后续可通过发起分账请求将结算后的钱分到该分账接收方。
     *
     * @param request
     * @return
     */
    @PostMapping("/profitsharing/receivers/add")
    Resp<SmartProfitSharingAddReceiverResult> profitSharingAddReceiver(@RequestBody SmartProfitSharingReceiverRequest request);

    /**
     * 商户发起删除分账接收方请求，删除后不支持将结算后的钱分到该分账接收方。
     *
     * @param request
     * @return
     */
    @PostMapping("/profitsharing/receivers/remove")
    Resp<SmartProfitSharingRemoveReceiverResult> profitSharingRemoveReceiver(@RequestBody SmartProfitSharingReceiverRequest request);


}
